package grisar.gris.struct.bound;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.RectF;
import grisar.gris.struct.I_Bounding;
import grisar.gris.struct.I_GameObject;

public class BoundBox implements I_Bounding {

	private int width, height;
	private I_GameObject gObj;
	private Paint paint = new Paint();
	
	public BoundBox(I_GameObject gObj, int width, int height){
		
		paint.setAlpha(100);
		paint.setColor(Color.RED);
		this.width = width;
		this.height = height;
		this.gObj = gObj;
	}
	
	//@Override
	public boolean isColliding(I_Bounding bound) {

		return BoundHelper.isColliding(this, bound);
	}

	//@Override
	public Point getPosition() {
		
		return gObj.getPosition();
	}

	//@Override
	public void setPosition(Point pos) {
		
		gObj.setPosition(pos);
	}
	
	public int getHeight(){
		
		return height;
	}
	
	public int getWidth(){
		
		return width;
	}

	//@Override
	public void draw(Canvas canvas) {
		
		canvas.drawRect(new RectF(gObj.getPosition().x, gObj.getPosition().x+width, gObj.getPosition().y, gObj.getPosition().y+height), paint);
	}

	//@Override
	public I_Bounding getBounding() {
		
		return this;
	}

}
